﻿@extends("admin.base.base")
@section("title")
<title>基本设置</title>
@endsection
@section("content")
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	系统管理
	<span class="c-gray en">&gt;</span>
	基本设置
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
		<div id="tab-system" class="HuiTab">
			<div class="tabBar cl">
				<span>基本设置</span>
				<span>邮件设置</span>
				<span>第三方代码</span>
			</div>
            <form class="form form-horizontal" id="form-base-add">
			    <div class="tabCon" id="one">
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">网站名称：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="website-title" name="title" placeholder="控制在25个字、50个字节以内" value="{{$item->title}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">网站LOGO：</label>
                        <div class="formControls col-xs-8 col-sm-9" style="display: flex;flex-direction: column">
                            @if($item->logo != '')
                                <img src="../../public/store/{{$item->logo}}" class="logo" width="100" height="100" style="margin-bottom: 15px;">
                                <input type="hidden" name="logo" value="{{$item->logo}}" onchange="reads(this)">
                            @else
                                <img src="" class="logo" width="100" height="100" style="display: none">
                            @endif
                            <input type="file" name="logo" value="" onchange="reads(this)">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">地址栏图标：</label>
                        <div class="formControls col-xs-2 col-sm-2" style="display: flex;flex-direction: column">
                            @if($item->icon != '')
                                <img src="../../public/store/{{$item->icon}}" class="icon" width="100" height="100" style="margin-bottom: 15px">
                                <input type="hidden" name="icon" value="{{$item->icon}}" onchange="res(this)">
                            @else
                                <img src="" class="icon" width="100" height="100" style="display: none">
                            @endif
                            <input type="file" name="icon" value="" onchange="res(this)">
                        </div>
                        <span style="color: #cccccc">建议尺寸 32 * 32 (像素)的.ico文件</span>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">网站关键词：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="website-Keywords" name="keywords" placeholder="建议3到4个关键词" value="{{$item->keywords}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">网站描述：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="website-description" name="description" placeholder="控制在80个汉字，160个字符以内" value="{{$item->description}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">底部版权信息：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="website-copyright" name="copyright" placeholder="&copy; 2016 H-ui.net" value="{{$item->copyright}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">备案号：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="website-icp" name="record_number" placeholder="京ICP备00000000号" value="{{$item->record_number}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">地址：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" name="address" placeholder="湖南省长沙市麓谷企业广场XXX栋XXX层" value="{{$item->address}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">手机：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" name="mobile" placeholder="17788888888" value="{{$item->mobile}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">邮箱：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" name="email" placeholder="abc@qq.com" value="{{$item->email}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">客服QQ：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" name="qq" placeholder="11042048421" value="{{$item->qq}}" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">客服电话：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" name="tel" placeholder="0731-89347233" value="{{$item->tel}}" class="input-text">
                        </div>
                    </div>
                    <input type="hidden" value="1" name="tab-1">
                    {{csrf_field()}}
                    <div class="row cl">
                        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                            <button onClick="article_base_save_submit();" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                            <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                        </div>
                    </div>
			    </div>
            </form>
            <form class="form form-horizontal" id="form-email-add">
			    <div class="tabCon" id="two">
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">邮件发送模式：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text"  class="input-text" value="" id="" name="">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">SMTP服务器：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="" value="" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">SMTP 端口：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" value="25" id="" name="" >
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">邮箱帐号：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" class="input-text" value="5" id="emailName" name="emailName" >
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">邮箱密码：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="password" id="email-password" value="" class="input-text">
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">收件邮箱地址：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <input type="text" id="email-address" value="" class="input-text">
                        </div>
                    </div>
                    <input type="hidden" name="tab-2" value="2">
                    {{csrf_field()}}
                    <div class="row cl">
                        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                            <button onClick="article_email_save_submit();" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                            <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                        </div>
                    </div>
			    </div>
            </form>
            <form class="form form-horizontal" id="form-code-add">
			    <div class="tabCon" id="three">
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">百度商桥：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <textarea class="textarea" name="baidu-shangqiao"></textarea>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2"></label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <p style="color: #cccccc">代码会放在<span>&lt;/head&gt;</span>标签以上</p>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">百度统计：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <textarea class="textarea" name="baidu-tongji"></textarea>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2"></label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <p style="color: #cccccc">代码会放在<span>&lt;/head&gt;</span>标签以上</p>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2">离线宝：</label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <textarea class="textarea" name="li-xian-bao"></textarea>
                        </div>
                    </div>
                    <div class="row cl">
                        <label class="form-label col-xs-4 col-sm-2"></label>
                        <div class="formControls col-xs-8 col-sm-9">
                            <p style="color: #cccccc">代码会放在<span>&lt;/body&gt;</span>标签以上</p>
                        </div>
                    </div>
                    {{csrf_field()}}
                    <input type="hidden" name="tab-3" value="3">
                    <div class="row cl">
                        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                            <button onClick="article_code_save_submit();" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
                            <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                        </div>
                    </div>
			    </div>
            </form>
		</div>
</div>
@endsection
@section("js")
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="{{asset('lib/My97DatePicker/4.8/WdatePicker.js')}}"></script>
<script type="text/javascript" src="{{asset('lib/jquery.validation/1.14.0/jquery.validate.js')}}"></script>
<script type="text/javascript" src="{{asset('lib/jquery.validation/1.14.0/validate-methods.js')}}"></script>
<script type="text/javascript" src="{{asset('lib/jquery.validation/1.14.0/messages_zh.js')}}"></script>
<script type="text/javascript">
//logo图片展示
function reads(obj) {
	var file = obj.files[0];
	if ($.isEmptyObject(file) == false){
		$(".logo").css('display','block');
		var reader = new FileReader();
		reader.readAsDataURL(file);
		reader.onload = function (ev) {
			$(".logo").attr("src",ev.target.result);
		}
	}
}
//icon小图标展示
function res(obj) {
    var file = obj.files[0];
    if ($.isEmptyObject(file) == false){
        $(".icon").css('display','block');
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = function (ev) {
            $(".icon").attr("src",ev.target.result);
        }
    }
}
//基本资料提交
function article_base_save_submit() {
    var formData = new FormData($("#form-base-add")[0]);
	$.ajax({
        headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
		type:'POST',
		url:'{{url('admin/system')}}',
		data:formData,
        contentType:false,
        processData:false,
		dataType:'json',
		success:function (resp) {
			if(resp.code == 0){
			    layer.msg(resp.msg);
			}else {
			    layer.msg(resp.msg);
			}
        }
	});
}
//邮件设置提交
function article_email_save_submit() {

}
//第三方代码提交
function article_code_save_submit() {
    var data = $("#form-code-add").serializeArray();
    $.ajax({
        type:"POST",
        url:"{{url('admin/system')}}",
        data:data,
        dataType:"json",
        success:function (resp) {
            if(resp.code == 0){
                layer.msg(resp.msg);
            }else {
                layer.msg(resp.msg);
            }
        }
    });
}
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#tab-system").Huitab({
		index:0
	});
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
@endsection
